]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-entry: Force a relayout if necessary
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 12 Oct 2012 20:37:18 +0000 (22:37 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 15 Oct 2012 21:01:42 +0000 (23:01 +0200)
ClutterText will only queue a relayout after font changes if it has
any contents other than the empty string. As a result, its height
request may change after the first character has been entered. To
avoid this visual glitch, force a relayout on actual font changes.

https://bugzilla.gnome.org/show_bug.cgi?id=685534

src/st/st-entry.c

index c6b8701f84fcab4e2e925cd4dca8c3d8dec0209c..ad9b3a84f84847e27459e1a646abb43c27ed0052 100644 (file)
@@ -242,7 +242,7 @@ st_entry_style_changed (StWidget *self)
   StThemeNode *theme_node;
   ClutterColor color;
   const PangoFontDescription *font;
-  gchar *font_string;
+  gchar *font_string, *font_name;
   gdouble size;
 
   theme_node = st_widget_get_theme_node (self);
@@ -264,8 +264,12 @@ st_entry_style_changed (StWidget *self)
 
   font = st_theme_node_get_font (theme_node);
   font_string = pango_font_description_to_string (font);
+  font_name = g_strdup (clutter_text_get_font_name (CLUTTER_TEXT (priv->entry)));
   clutter_text_set_font_name (CLUTTER_TEXT (priv->entry), font_string);
+  if (strcmp (clutter_text_get_font_name (CLUTTER_TEXT (priv->entry)), font_name) != 0)
+    clutter_actor_queue_relayout (priv->entry);
   g_free (font_string);
+  g_free (font_name);
 
   ST_WIDGET_CLASS (st_entry_parent_class)->style_changed (self);
 }